package com.fc.mall.service.impl;

import com.fc.mall.mapper.PmsFeightTemplateMapper;
import com.fc.mall.model.PmsFeightTemplate;
import com.fc.mall.model.PmsFeightTemplateExample;
import com.fc.mall.service.PmsFeightService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Sunny on 2019/6/18.
 */
@Service
public class PmsFeightServiceImpl implements PmsFeightService {

    @Autowired
    private PmsFeightTemplateMapper pmsFeightTemplateMapper;


    @Override
    public List<PmsFeightTemplate> queryList(int pageSize, int pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        PmsFeightTemplateExample example = new PmsFeightTemplateExample();
        example.createCriteria();
        List<PmsFeightTemplate> feightTemplateList = pmsFeightTemplateMapper.selectByExample(example);
        return feightTemplateList;
    }

    @Override
    public int addFeightTemplate(PmsFeightTemplate pmsFeightTemplate) {
        return pmsFeightTemplateMapper.insertSelective(pmsFeightTemplate);
    }

    @Override
    public int updateFeightTemplate(PmsFeightTemplate pmsFeightTemplate) {

        return pmsFeightTemplateMapper.updateByPrimaryKeySelective(pmsFeightTemplate);
    }

    @Override
    public PmsFeightTemplate queryById(Long id) {
        return pmsFeightTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public int delFreightTemplate(Long id) {
        return pmsFeightTemplateMapper.deleteByPrimaryKey(id);
    }


}
